<template>
  <div class="showBox">
    <div class="head">
      <select-store @handleChange="optionChange"/>
      <div class="serach">
        <el-input size="small" placeholder="请输入姓名进行搜索" v-model="searchKey"></el-input>
        <el-button size="mini" type="primary" round @click="searchBy">搜索</el-button>
      </div>

      <div class="add"></div>
    </div>

    <div class="table" v-loading="loading">
      <el-table :data="tableData" size="mini"   default-expand-all>
        <el-table-column type="index" label="序号" align="center" width="50"></el-table-column>
        <el-table-column prop="userName" label="员工姓名" align="center"></el-table-column>
        <el-table-column prop="orgName" label="所属门店" align="center"></el-table-column>
        <el-table-column
          prop="faceStatus"
          label="操作"
          width="150"
          align="center"

        >
          <template slot-scope="scope">
            <el-tag
              :type="scope.row.faceStatus?'success':'danger'"
              style="margin-bottom: 0;"
              size="medium"
              @click="goUpload(scope.row)"
            >{{scope.row.faceStatus?'已上传':'未上传'}}</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <div class="paging">
      <el-pagination
        @size-change="SizeChange"
        @current-change="CurrentChange"
        :page-sizes="[10, 20, 30, 50, 100]"
        :current-page="currentPage"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>

<script>
import { queryStoreOrgseq } from "@/api/memberinfo";
import { queryEmpInfoData } from "@/api/smartShops";
import selectStore from '../components/selectStore'
export default {
  components: {selectStore},
  props: {},
  data() {
    return {
      loading:false,
      options: [],
      value: [],
      searchKey: "",
      pageSize: 10,
      total: 0,
      currentPage: 1,
      tableData: [],
    };
  },
  watch: {},
  computed: {},
  methods: {
    optionChange(val) {
      this.orgSeq = val[val.length - 1];
      this.getData();
    },
    goUpload(row) {
      this.$router.push({
        name: "empInfoUpload",
        params: {
          userList: row,
          orgSeq:this.orgSeq
        }
      });
    },
    searchBy() {
      this.getData();
    },
    SizeChange(size) {
      this.pageSize = size;
      this.getData();
    },
    CurrentChange(current) {
      this.currentPage = current;
      this.getData();
    },
    async getData() {
      this.loading = true;
      let data = await queryEmpInfoData({
        size: this.pageSize,
        current: this.currentPage,
        condition: {
          realName: this.searchKey,
          orgSeq: this.orgSeq
        }
      });
      this.tableData = data.records;
      this.total = data.total;
      this.loading= false;
    },

  },
  created() {
    this.orgSeq =
      JSON.parse(localStorage.getItem("logininfo")).orgList[0].orgSeq || "";

  },
  mounted() {
    this.getData();
  }
};
</script>
<style lang="scss" scoped>
.showBox {
  width: 100%;
  height: 100%;

  .head {
    border-bottom: 1px solid #dcdfe6;
    width: 100%;
    box-sizing: border-box;
    height: 50px;
    padding: 9px 0;
    display: flex;
    align-items: flex-end;
    position: relative;

    img {
      width: 30px;
      height: 32px;
      margin-right: 10px;
    }

    p {
      padding: 0 10px;
      font-size: 14px;
    }

    .selectStore {
      height: 32px;
      width: 300px;
      display: flex;
      align-items: center;

      .el-cascader {
        width: 200px;
      }
    }

    .serach {
      height: 100%;
      width: 280px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .el-input {
        width: 210px;
      }
    }
  }
}
</style>

<style lang="scss">
/*这是联级单选时使用单选模式时隐藏redio元素的*/
// .chooseTheater{
//   border: 1px solid red;
// }
</style>
